<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
    <div id="app">
    
</div>
<script>
    let App = {
        template:`
        <div>
            <p>{{ str | filterTime }}</p>
            // <p>{{ str | filter2 }}</p>
            </div>
        `,
        data(){
            return{
                str:'2',
                time:1614047727870
            }
            // filters;{
            //     filter2(value);{
            //         return '处理之后的' + value
            //     }
            // }
        }
    }
    Vue.filter('filterTime',function(time){
        let year = new Date(time).getFullYear();
        let month = new Date(time).getMonth()+1;
        let day = new Date(time).getDate();
        return year + '年' + month + '月' +  day  +  '日'
    })
    new Vue({
    render: h=> h (App)
    }).$mount('#app')
</script>
</body>
</html>